package ipebg.mzk.provider.activemq.service.impl;

import ipebg.mzk.facade.activemq.service.ProducerService;

import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
import org.springframework.stereotype.Service;

@Service("producerServiceImpl")
public class ProducerServiceImpl implements ProducerService {
	private static Log log = LogFactory.getLog(ProducerServiceImpl.class);
<<<<<<< HEAD
	/*@Autowired*/
=======
	@Autowired
>>>>>>> ce8566db0175a5dea3ad94289e2ccc7ffd8a63f3
	private JmsTemplate jmsTemplate;

	@Override
	public void sendMessage(Destination destination, final String message) {
		
		jmsTemplate.send(destination, new MessageCreator() {
			@Override
			public Message createMessage(Session session) throws JMSException {
				return session.createTextMessage(message);
			}
		});
	}

}
